package com.travel.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;

/**
 * 火车班次表
 * @TableName train
 */
@TableName(value ="train")
@Data
public class Train implements Serializable {
    /**
     * 火车班次id
     */
    @TableId(value = "id")
    private Integer id;

    /**
     * 火车动车座位类型表 (1、高铁  2、动车  3、普通  4、其他)
     */
    @TableField(value = "train_seat_type")
    private Integer trainSeatType;

    /**
     *  发车点 对应train_station表id
     */
    @TableField(value = "grid_position")
    private Integer gridPosition;

    /**
     * 结束位置 对应train_station表id
     */
    @TableField(value = "end_position")
    private Integer endPosition;

    /**
     * 价格
     */
    @TableField(value = "price")
    private BigDecimal price;

    /**
     * 剩余座位数量
     */
    @TableField(value = "remaining_amount")
    private Integer remainingAmount;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Train other = (Train) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTrainSeatType() == null ? other.getTrainSeatType() == null : this.getTrainSeatType().equals(other.getTrainSeatType()))
            && (this.getGridPosition() == null ? other.getGridPosition() == null : this.getGridPosition().equals(other.getGridPosition()))
            && (this.getEndPosition() == null ? other.getEndPosition() == null : this.getEndPosition().equals(other.getEndPosition()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getRemainingAmount() == null ? other.getRemainingAmount() == null : this.getRemainingAmount().equals(other.getRemainingAmount()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTrainSeatType() == null) ? 0 : getTrainSeatType().hashCode());
        result = prime * result + ((getGridPosition() == null) ? 0 : getGridPosition().hashCode());
        result = prime * result + ((getEndPosition() == null) ? 0 : getEndPosition().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getRemainingAmount() == null) ? 0 : getRemainingAmount().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", trainSeatType=").append(trainSeatType);
        sb.append(", gridPosition=").append(gridPosition);
        sb.append(", endPosition=").append(endPosition);
        sb.append(", price=").append(price);
        sb.append(", remainingAmount=").append(remainingAmount);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}